﻿using System;
using System.IO;

namespace PokemonBattle.PokemonData
{
    [Serializable()]
    public class MoveLearnData : DataStream
    {
        public string Info { get; set; }
        public string LearnBy { get; set; }
        public string MoveName { get; set; }
        public Trait WithoutTrait { get; set; }

        public MoveLearnData()
        {
            MoveName = string.Empty;
            LearnBy = string.Empty;
            Info = string.Empty;
        }

        #region abstract

        public override void Load(Stream input)
        {
            BinaryReader reader = new BinaryReader(input);
            this.WithoutTrait = (Trait)reader.ReadInt32();
            this.MoveName = reader.ReadString();
            this.LearnBy = reader.ReadString();
            this.Info = reader.ReadString();
        }

        public override void Save(Stream output)
        {
            BinaryWriter writer = new BinaryWriter(output);
            writer.Write((int)this.WithoutTrait);
            writer.Write(this.MoveName);
            writer.Write(this.LearnBy);
            writer.Write(this.Info);
        }

        #endregion

        public static MoveLearnData FromStream(Stream input)
        {
            return FromStream<MoveLearnData>(input);
        }
    }
}
